perm filename TEST.PAL[HAL,HE]1 blob
sn#122333 filedate 1974-10-03 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00004 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 GENERAL PURPOSE TEST ROUTINE
C00003 00003 UTILITY INPUT ROUTINES FOR DEBUGGING INTERP
C00008 00004 program initialization
C00011 ENDMK
C⊗;
;GENERAL PURPOSE TEST ROUTINE
.INSRT HALHED.PAL[HAL,HE]
.=STRT11
.INSRT HALIO.PAL[HAL,HE]
;INSRT HALRTR.PAL[HAL,HE]
;INSRT GRAPHS.PAL[HAL,HE]
;INSRT FBUG.PAL[1,BES]
;INSRT ARITH.PAL[HAL,HE]
.INSRT INTERP.PAL[HAL,HE]
;Currently under test
;Data areas
.BLKW 100
STACK: .BLKW 1
ARG1: .BLKW 32. ;Long enough for a trans
ARG2: .BLKW 32. ;Long enough for a trans
RES: .BLKW 32. ;Long enough for a trans
CURIN: INBUF ;Current line pointer
;UTILITY INPUT ROUTINES FOR DEBUGGING INTERP
;Routine to read a floating number into location pointed to by R0.
FLREAD: MOV R0,-(SP) ;Save arg.
MOV CURIN,R0 ;R0 ← current line pointer
FLRD2: JSR PC,RELSCN ;AC0 ← number typed in
TST R1 ;Got anything?
BEQ FLRD1 ;Yes.
MOV #INBUF,R0 ;No. Prepare to read a new line.
JSR PC,INSTR ;
MOV #INBUF,R0 ;
BR FLRD2 ;
FLRD1: MOV R0,CURIN ;New current line pointer
STF AC0,@(SP)+ ;Put number in desired place.
RTS PC ;Done
;Routine to get a scalar argument into arg1 or arg2, whichever R0 points to
SCALIN: OUTSTR SCLMES ;Say we want a scalar
MOV R0,-(R3) ;Stack the argument
CLRB @CURIN ;Force a move to new line.
JSR PC,FLREAD ;Read it.
RTS PC ;Done
SCLMES: ASCIE </SCALAR, PLEASE: />
;Routine to get a vector argument into arg1 or arg2, whichever R0 points to
VECTIN: MOV R2,-(SP) ;Save R2
OUTSTR VCTMES ;Say we want a vector
MOV R0,-(R3) ;Stack the destination
MOV R0,-(SP) ;and save a copy on the other stack, too.
CLRB @CURIN ;Force a move to new line.
MOV #4,R2 ;Need to read 4 scalars
VCTIN1: JSR PC,FLREAD ;Get one
MOV (SP),R0 ;Retrieve location
ADD #4,R0 ;Update location
MOV R0,(SP) ;Save it again
SOB R2,VCTIN1 ;Go back and pick up other fields
TST (SP)+ ;Clean off stack
MOV (SP)+,R2 ;Restore R2.
RTS PC ;Done
VCTMES: ASCIE </I NEED A VECTOR. GIVE ME 4 SCALARS, PLEASE:
/>
;Routine to get a trans argument into arg1 or arg2, whichever R0 points to
TRNSIN: MOV R2,-(SP) ;Save R2
OUTSTR TRNMES ;Say we want a vector
CLRB @CURIN ;Force a move to new line.
MOV R0,-(R3) ;Stack the destination
MOV R0,-(SP) ;and save a copy on the other stack, too.
MOV #16.,R2 ;Need to read 16 scalars
TRNSN1: JSR PC,FLREAD ;Get one
ADD #4,(SP) ;Update location
MOV (SP),R0 ; and retrieve it.
SOB R2,TRNSN1 ;Go back and pick up other fields
TST (SP)+ ;Clean off stack
MOV (SP)+,R2 ;Restore R2.
RTS PC ;Done
TRNMES: ASCIE </I NEED A TRANS. GIVE ME 16 SCALARS, PLEASE:
/>
;Routine to print the scalar argument pointed to by R0
SCLOUT: LDF (R0),AC0 ;Pick up number.
MOV #OUTBUF,R0 ;
JSR PC,CVG ;Convert it to string
MOV #OUTBUF,R0 ;
JSR PC,TYPSTR ;Print it.
RTS PC ;Done
;Routine to print the vector argument pointed to by R0
VECOUT: MOV R2,-(SP) ;Save R2
MOV R3,-(SP) ;Save R3
MOV R0,R2 ;R2 ← LOC[next field]
MOV #4,R3 ;Need to print 4 fields
VCOUT1: LDF (R2)+,AC0 ;Pick up a field
MOV #OUTBUF,R0 ;
JSR PC,CVG ;Convert it to string
MOV #OUTBUF,R0 ;
JSR PC,TYPSTR ;Print it.
SOB R3,VCOUT1 ;Do all this 4 times
MOV (SP)+,R3 ;Restore R3
MOV (SP)+,R2 ;Restore R2
RTS PC ;Done
; program initialization
START: RESET
MOV #500,SP ;initialize stack
CLR PS ;initialize processor status
CLKIN: CLR CLKCNT ;clear clock registers- trap restart
CLR CLKSET
CLR CLKS
MOV #043400,R0 ;No interrupts, single precision
LDFPS R0 ;Load Floating Processor Status
MOV #16,R0 ;Field length
MOV #10,R1 ;Decimal digits
JSR PC,FORMAT ;
MOV #STACK,R3 ;Set up argument stack
TEST: CRLF ;
CRLF
MOV #ARG1,R0 ;
JSR PC,SCALIN ;Get first argument
MOV #ARG2,R0 ;
JSR PC,SCALIN ;Get second argument
MOV #1000.,R4 ;Do the test 1000 times
CLR CLKSET ;
MOV #21,CLKS ;Start counting up
TST1: MOV #STACK,R3 ;Set up argument stack
MOV #ARG1,-(R3) ;Restore interpreter stack
MOV #ARG2,-(R3) ; with both arguments.
JSR PC,SAS ;Call the routine under test
SOB R4,TST1 ;Do it over and over
CLR CLKS ;Stop the clock
MOV CLKCNT,R0 ;R0 ← Number of 10 micros elapsed
JSR PC,TYPDEC ;Print it.
MOV (R3)+,R0 ;
JSR PC,SCLOUT ;Print answer
BR TEST ;Over and over
;The rest of this will never get executed. Left here for historical reasons:
.IFNZ 0
MOV #1000.,R3 ;Do the test 1000 times
CLR CLKSET ;
MOV #21,CLKS ;Start counting up
TST1: STF AC0,-(SP) ;Save AC0
JSR PC,SQRTF ;AC0 ← SQRT(AC0)
LDF (SP)+,AC0 ;Restore AC0
SOB R3,TST1 ;Do it over and over
CLR CLKS ;Stop the clock
MOV CLKCNT,R0 ;R0 ← Number of 10 micros elapsed
JSR PC,TYPDEC ;Print it.
CRLF ;
MOV #STRING,R0 ;
JSR PC,CVG ;Print answer
OUTSTR STRING ;
BR TEST ;Loop
HALERR TSTDON ;Finished here. Terminate cleanly.
TSTDON: ASCIE /Done./
.ENDC
.END START